<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLettersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('letters', function (Blueprint $table) {
            $table->increments('id');
            $table->char('uuid', 32)->unique(); //$table->uuid() = char(36) by default

            $table->bigInteger('sender_id')->unsigned();
            $table->bigInteger('receiver_id')->unsigned();

            $table->char('status', 1)->default('0');
            //0: new
            //1: read
            //2: replied
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('letters');
    }
}
